Please remember this is a work in progress. Home » Deployment » ISAPI

ISAPI

 

ISAPI on Apache

 

1. Pre-requisites

1.1. Apache for Windows. Current version is 2.4. We recommend the Apache Haus distribution: https://www.apachehaus.com/cgi-bin/download.plx

2. Installing and configuring Apache on Windows Server

When installing Apache, you need to select the desired Apache version (32 or 64 bits) in advance. If you your goal is to use ISAPI on Apache, your DLL has to match Apache server, i.e. if your ISAPI DLL is 32 bits, your Apache Web Server also has to be 32 bits, otherwise install the 64-bit version. You can install both 32 and 64 bits on the same machine, however they will need to be installed in different folders and configured separately (each one is a different service, with a different httpd.conf config file).

After installing Apache, it is recommended that you install it as a Windows service, using the command line: httpd.exe -k install

3. Configuring the httpd.conf file

All configuration of the Apache server is stored in the httpd.conf file. By default, ISAPI is not enabled in some distributions of Apache for Windows, so the first step is enabling it.

First, Open the file httpd.conf (you will find this file in folder conf, under Apache installation directory) in a text editor.

3.1. Locate the word isapi_module within the file. You will find the following line:

#LoadModule isapi_module modules/mod_isapi.so

If the line is commented out with a # char in front of it, remove it. Otherwise, if it's not commented out, ISAPI has been already enabled.

3.2. Now locate the section <IfModule alias_module> within the file. In the end of this section you will find the ScriptAlias section. Add one line in the end of this section, like this:

ScriptAlias /isapi/ "${SRVROOT}/ISAPI/"

This maps an URL base to a physical path on ther server where your application is. The ScriptAlias word is fixed, and the other two are defined by the user.
The first (in our example, /isapi/) is the URL Base of the ISAPI application. The URL Base is part of the URL address of the application on the server.
The second is the physical path where your ISAPI DLL will be copied to. Here you can use both an absolute path (e.g. c:\ISAPI_Apps) as well as paths relative to the Apache installation directory, using the ${SRVROOT} variable.
This line instructs Apache that anything coming to http(s)://yourserver/isapi/yourapp.dll should be forwarded to an ISAPI module named yourapp.dll inside "${SRVROOT}/ISAPI/" physical folder.

3.3. Add a new <Directory> entry, as shown below:

<Directory "${SRVROOT}/ISAPI">
   Options All
   AllowOverride None
   Require all granted
   ISAPIAppendLogToErrors on
</Directory>


The directory above is the pysical path of your application (the same that you used in item 3.2).

3.4. Finally, inside section <IfModule mime_module>, search for the AddHandler subsection and add three new lines if not existing, as below:

   # ISAPI Support
   AddHandler isapi-handler .dll
   ISAPIAppendLogToErrors on


Now you need to restart the Apache service from the Windows Service console and see if it starts correctly. Any configuration error (something wrong with the httpd.conf file) will probably make Apache service to fail loading. In this case, check the Windows Application Event Log for the specific error message.

4. Final notes

Two important things to remember:

1- The DLL "bitness" must always match server's, i.e. 32-bit DLLs require 32-bit servers, and 64-bit DLLs require 64-bit Apache servers.

2- Always restart the Apache service every time you change anything in the httpd.conf file, because Apache only loads the config during startup.

You can read more information about Apache on Windows here: https://httpd.apache.org/docs/2.4/platform/windows.html

 

Terms of Use | Privacy Statement © 2002 - 2024 Atozed Software